﻿using System;
using System.Text;
using DaaseVarmer.domain;
using Microsoft.SPOT;


namespace DaaseVarmer.RemoteControl
{
    class RemoteControlStub : IRemoteControl
    {

        public string Ping()
        {
            Debug.Print(" ping - memory available: " + Debug.GC(true));
            return "pong";
        }

        private Random r = new Random();
        public double GetSensorData(SensorType t)
        {
            Debug.Print("GetSensorData - memory available: " + Debug.GC(true));
            switch ( t )
            {
                default:
                case SensorType.IndoorTemp:
                    return Settings.Instance.OutsiteTemp[0] +10;

                case SensorType.OutdoorTemp:
                    return Settings.Instance.OutsiteTemp[0];

                case SensorType.SolarHeaterTemp:
                    return Settings.Instance.SolarHeaterTemp[0];

                case SensorType.AirFlow:
                    return Settings.Instance.MotorSpeed * 3.14;
            }
            
        }

        public Modes GetMode()
        {
            if (Settings.Instance.ManuelOverride)
            {
                return Modes.Speed;
            } else
            {
                return Modes.Auto;
            }
        }

        public int GetSpeed()
        {
            return Settings.Instance.MotorSpeed;
        }

        public double GetToTemp()
        {
            return -1;
        }

        public int GetMin()
        {
            return -1;
        }


        public void SetModeAuto()
        {
            Settings.Instance.ManuelOverride = false;
        }

        public void SetModeSpeed(int speed)
        {
            lock (Settings.Instance)
            {
                Settings.Instance.ManuelOverride = true;
                Settings.Instance.MotorSpeed = speed;
            }
           
            
        }

        public void SetModeSpeedTemp(int speed, double temp)
        {
            //
        }

        public void SetModeSpeedTime(int speed, int time)
        {
            
        }
    }
}
